<?php

namespace backend\models;

use Yii;
use common\models\UserInfo;

/**
 * This is the model class for table "sys_user_feedback".
 *
 * @property integer $id
 * @property integer $uid
 * @property integer $time
 * @property string $title
 * @property string $content
 */
class SysUserFeedback extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'sys_user_feedback';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['uid', 'time'], 'integer'],
            [['content'], 'string'],
            [['title'], 'string', 'max' => 512]
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'uid' => Yii::t('app','Uid'),
            'time' => Yii::t('app','Feedback Time'),
            'title' => Yii::t('app','Feedback Title'),
            'content' => Yii::t('app','Feedback Content'),
        ];
    }
    public function getUsernameByRead()
    {
    	return $this->hasOne(UserInfo::className(), ['id'=>'uid']);
    }
}
